package pdf.book.algorithm;


import java.util.Arrays;

public class BinarySearch{
    public static int binary(int[] array, int value){
        int low = 0;
        int high = array.length - 1;
        while(low <= high){
            int middle = (low + high) / 2;
            if(value < array[middle]){
                high = middle - 1;
            }else if(value > array[middle]){
                low = middle + 1;
            }else{
                return middle;
            }
        }
        return -1;
    }
//    public static void main(String[] args){
//        int[] whiteList = In.readInts(args[0]);
//        Arrays.sort(whiteList);
//        while(!StdIn.isEmpty()) {
//        	int key = StdIn.readInt();
//        	if(rank(whiteList, key) == -1)
//        		StdOut.println(key);
//        }
//    }
}


